package com.itheima.homework.threadPool;

import com.itheima.demo.ThreadPool;

import java.util.concurrent.*;

public class ThreadPoolDiscard1 {
    public static void main(String[] args) {
        ThreadPoolExecutor executor = new ThreadPoolExecutor(150000000,150000000,1,
                TimeUnit.SECONDS, new ArrayBlockingQueue<>(150000000), Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.DiscardOldestPolicy());
        for (int i = 0; i < 150000000; i++) {
            executor.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName() + "执行了!");
                }
            });
        }
    }
}
